﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BluSteamServer.Model
{
    public class UpdateUserListCommand : Command
    {
        private readonly string _newUser;

        public UpdateUserListCommand(string newUser)
        {
            _newUser = newUser;
        }

        public void Execute()
        {
            // notify each connected client of new user connection
            string message = "$CP2011~SERVER~RESPONSE~UPDATE_CLIENT_LIST~" + _newUser;
            Network.Broadcast(message);

            // notify new user of each connected client
            message = "$CP2011~SERVER~RESPONSE~UPDATE_CLIENTLIST~";
            Network.SendMessageForEachUser(message, _newUser);
        }
    }
}
